// stylelint-disable selector-max-type

// Link-like buttons
//
// This class is for styling <button> and <input> elements to look like links
.btn-link {
  display: inline-block;
  padding: 0;
  font-size: inherit;
  color: $text-blue;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
  background-color: transparent;
  border: 0;
  appearance: none; // Corrects inability to style clickable `input` types in iOS.

  &:hover {
    text-decoration: underline;
  }

  &:disabled,
  &[aria-disabled="true"] {
    &,
    &:hover {
      // stylelint-disable-next-line primer/colors
      color: rgba($gray-600, 0.5);
      cursor: default;
    }
  }
}

// Invisible button
//
// Typically used as a "cancel" button next to a .btn
.btn-invisible {
  color: $text-blue;
  background-color: transparent; // Reset default gradient backgrounds and colors
  border: 0;
  border-radius: 0;
  box-shadow: none;

  &:hover,
  &:active,
  &:focus,
  &.selected,
  &[aria-selected="true"],
  &.zeroclipboard-is-hover,
  &.zeroclipboard-is-active {
    color: $text-blue;
    background: none;
    outline: none;
    box-shadow: none;
  }
}

// Octicon button
//
// Icon-only buttons
.btn-octicon {
  display: inline-block;
  // stylelint-disable-next-line primer/spacing
  padding: 5px;
  // stylelint-disable-next-line primer/spacing
  margin-left: 5px;
  line-height: $lh-condensed-ultra;
  color: $text-gray;
  vertical-align: middle;

  // For `<button>` elements
  background: transparent;
  border: 0;

  &:hover {
    color: $text-blue;
  }

  &.disabled,
  &[aria-disabled="true"] {
    // stylelint-disable-next-line primer/colors
    color: $gray-400;
    cursor: default;

    // stylelint-disable-next-line primer/colors
    &:hover {
      color: $gray-400;
    }
  }
}

.btn-octicon-danger:hover {
  color: $text-red;
}

// Close button
//
// Typically used with an octicon-x
.close-button {
  padding: 0;
  background: transparent;
  border: 0;
  outline: none;
}

// Hidden text button
//
// Use `.hidden-text-expander` to indicate and expand hidden text.
.hidden-text-expander {
  display: block;

  &.inline {
    position: relative;
    top: -1px;
    display: inline-block;
    // stylelint-disable-next-line primer/spacing
    margin-left: 5px;
    line-height: 0;
  }
}

.hidden-text-expander a,
.ellipsis-expander {
  display: inline-block;
  height: 12px;
  // stylelint-disable-next-line primer/spacing
  padding: 0 5px 5px;
  font-size: $font-size-small;
  font-weight: $font-weight-bold;
  // stylelint-disable-next-line primer/typography
  line-height: 6px;
  // stylelint-disable-next-line primer/colors
  color: $gray-700;
  text-decoration: none;
  vertical-align: middle;
  // stylelint-disable-next-line primer/colors
  background: lighten($gray-300, 5%);
  border: 0;
  // stylelint-disable-next-line primer/borders
  border-radius: 1px;

  &:hover {
    text-decoration: none;
    // stylelint-disable-next-line primer/colors
    background-color: darken($gray-300, 4%);
  }

  &:active {
    color: $text-white;
    // stylelint-disable-next-line primer/colors
    background-color: $blue-400;
  }
}

// Social button count
// TODO: Deprecate? Use BtnGroup instead?

.btn-with-count {
  float: left;
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;

  &:focus {
    z-index: 1;
  }
}

// Social count bubble
//
// A container that is used for social bubbles counts.

.social-count {
  position: relative;
  float: left;
  // stylelint-disable-next-line primer/spacing
  padding: 3px 12px;
  font-size: $font-size-small;
  font-weight: $font-weight-bold;
  // stylelint-disable-next-line primer/typography
  line-height: 20px;
  color: $text-gray-dark;
  vertical-align: middle;
  background-color: $bg-white;
  border: $border-width $border-style $border-color-button;
  border-left: 0;
  border-top-right-radius: $border-radius;
  border-bottom-right-radius: $border-radius;
  box-shadow: $box-shadow, $box-shadow-highlight;

  &:hover,
  &:active {
    text-decoration: none;
  }

  &:hover {
    color: $text-blue;
    cursor: pointer;
  }

  &:focus {
    z-index: 1;
    outline: 0;
    box-shadow: $box-shadow-focus;
  }
}
